package cn.mandifal.staticpages.service.impl;

import cn.mandifal.staticpages.service.ItemPageService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import javax.jms.JMSException;
import javax.jms.Message;
import javax.jms.MessageListener;
import javax.jms.ObjectMessage;

/**
 * 删除商品 sku 详情页面的监听器
 * @author shun
 */
@Component
public class ItemPageDeleteListener implements MessageListener {
    @Autowired
    private ItemPageService itemPageService;
    @Override
    public void onMessage(Message message) {
        ObjectMessage objectMessage= (ObjectMessage) message;
        try {
            Long[] goodsIds= (Long[]) objectMessage.getObject();
            boolean deleteItemHtml = itemPageService.deleteItemHtml(goodsIds);
            System.out.println("----------删除网页："+deleteItemHtml);
        } catch (JMSException e) {
            e.printStackTrace();
        }
    }
}
